home *** CD-ROM | disk | FTP | other *** search
- <%@ Language=VBScript CODEPAGE=65001 %>
- <!--#include file="include/wmsLocStrings.inc"-->
- <!--#include file="include/wmsCommon.inc"-->
- <!--#include file="include/wmsHeader.inc"-->
- <!--#include file="include/wmsPageBanner.inc"-->
- <!--#include file="include/wmsServerHash.inc"-->
- <!--#include file="include/wmsPlugins.inc"-->
- <!--#include file="include/wmsError.inc"-->
- <%
- '+-------------------------------------------------------------------------
- '
- ' Microsoft Windows Media
- ' Copyright (C) Microsoft Corporation. All rights reserved.
- '
- ' File: Networking.asp
- '
- ' Contents: Implements credentials and networking categories
- '
- '--------------------------------------------------------------------------
-
- BeginErrorHandling
- ConnectToServer
- ConnectToPubPoint
-
- Dim strOp
-
- Dim strTitleString
- Dim strHelpString
- Dim dwDisplayMode
- Dim iPPindex
-
- Dim bBufferOnServer
- Dim enumBufferSetting
-
- bBufferOnServer = FALSE
- enumBufferSetting = 0
-
- Dim strUserName
- Dim strPassword
- Dim strConfirm
-
- Dim bFinished
- bFinished = FALSE
-
- Const SHOWING_DISTCRED = 0
- Const SHOWING_BUFFERSETTING = 2
-
- dwDisplayMode = SHOWING_DISTCRED
-
- strUserName = Left( RemoveSpecifiedChars( SafeUnescape( trim( posting( "username" ) ) ), REGEXT_ILLEGAL_UNAME_CHARS ), MAX_USERNAME )
- strPassword = Left( RemoveDangerousCharacters( SafeUnescape( trim( posting( "password" ) ) ) ), MAX_PASSWD )
- strConfirm = Left( RemoveDangerousCharacters( SafeUnescape( trim( posting( "confirm" ) ) ) ), MAX_PASSWD )
-
- strOp = GetPostOrQsVal("submit")
- if( 0 = Len( strOp ) ) then
- strOp = trim( posting( "submit" ) )
- end if
-
- if( 0 = StrComp( CAT_CRED, qs("category") ) ) then
- dwDisplayMode = SHOWING_DISTCRED
-
- if ( 0 >= Len( strOp ) ) then
- bFinished = FALSE
- strUserName = g_objPubPoint.DistributionUserName
- if( ( 0 < Len( strUserName ) ) and ( TRUE = g_objPubPoint.IsDistributionPasswordSet ) ) then
- strPassword = L_PASSWORDPHOLD_TEXT
- strConfirm = L_PASSWORDPHOLD_TEXT
- else
- strPassword = ""
- strConfirm = ""
- end if
- else
- err.clear
- if( 0 < Len( strPassword ) ) then
- if( DetectSpecifiedChars( strPassword, REGEXP_DANGEROUS_CHARS ) ) then
- Err.Raise( -2 )
- Err.Description = L_PASSWORDBADCHAR_TEXT
- ErrorDetected( "Password" )
- elseif( 0 <> StrComp( strPassword, strConfirm, vbTextCompare ) ) then
- Err.Raise( -2 )
- Err.Description = L_PASSWORDMISMATCH_TEXT
- ErrorDetected( "Confirm" )
- else
- if( 0 < Len( strUserName ) ) then
- if( DetectSpecifiedChars( strUserName, REGEXP_DANGEROUS_CHARS ) ) then
- Err.Raise( -2 )
- Err.Description = L_USERNAMEBADCHAR_TEXT
- ErrorDetected( "User" )
- elseif( ( MAX_USERNAME >= Len( strUserName ) ) and ( MAX_PASSWD >= Len( strPassword ) ) ) then
- s_WMSAdmin.SetPubPointCredentials g_objPubPoint, strUserName, strPassword
- if( ErrorDetected( "User" ) ) then
- end if
- end if
- elseif g_objPubPoint.IsDistributionPasswordSet then
- g_objPubPoint.DistributionPassword = CStr( "" )
- end if
- end if
- else
- if( ( 0 = Len( strUserName ) ) and ( 0 = Len( strPassword ) ) and ( 0 = Len( strConfirm ) ) ) then
- s_WMSAdmin.SetPubPointCredentials g_objPubPoint, CStr( "" ), CStr( "" )
- else
- ' Persist just the username-- no password
- err.Clear
- if( 0 = Len( strUserName ) ) then
- s_WMSAdmin.SetPubPointCredentials g_objPubPoint, CStr( "" ), CStr( "" )
- elseif( MAX_USERNAME >= Len( strUserName ) ) then
- s_WMSAdmin.SetPubPointCredentials g_objPubPoint, strUserName, CStr( "" )
- end if
- err.clear
- end if
-
- end if
- if FALSE = ErrorDetected( "Pass" ) then
- bFinished = TRUE
- end if
- end if
- elseif( 0 = StrComp( L_BUFFERSETTING_TEXT, g_strDecodedInstance ) ) then
- dwDisplayMode = SHOWING_BUFFERSETTING
-
- if( 0 < Len( trim( posting( "buffering" ) ) ) ) then
- if( 0 = strComp( "1", trim( posting( "buffering" ) ) ) ) then
- if( 1 <> g_objPubPoint.BufferSetting ) then
- g_objPubPoint.BufferSetting = 1
- end if
- else
- if( 2 <> g_objPubPoint.BufferSetting ) then
- g_objPubPoint.BufferSetting = 2
- end if
- end if
-
- bFinished = TRUE
- end if
-
- else
- err.raise( -1 )
- end if
-
- if( bFinished ) then
- Response.Redirect( "pubpoint_props.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & g_strCategory & "&instance=" & g_strEncodedInstance )
- end if
-
- if( SHOWING_DISTCRED = dwDisplayMode ) then
- strTitleString = L_DISTCREDENTIALSNAME_TEXT
- strHelpString = L_DISTCREDHELP_TEXT
- elseif( SHOWING_BUFFERSETTING = dwDisplayMode ) then
- strTitleString = L_BUFFPROPPAGETITLE_TEXT
- strHelpString = ""
- end if
-
- WriteHTMLHeader( strTitleString ) %>
- <% WritePluginJSUtils %>
- <link rel="stylesheet" type="text/css" href="<%= Session( "cssName" ) %>">
- <%if( SHOWING_DISTCRED = dwDisplayMode ) then %>
- <script language="javascript">
- <!--
- /*@cc_on @*/
-
- ///////////////////////////
- function RemoveBadUsernameChars( szUnfiltered )
- {
- <% jsTRY %>
- var szSafeString = new String( szUnfiltered );
- var re = /\<|\>|\"|`|!|@|#|\$|\%|\^|\||\[|\]|\;|\:|\?|\(|\)|\{|\}|\&|\u201C|\u201D|\u201E|\"\&/gim;
- szSafeString = szUnfiltered.replace( re, "" );
-
- return( szSafeString );
- <% jsCATCH %>
- }
-
- var g_bUserAlertedToBadUerName = false;
- var g_bUserAlertedToBadPasswd = false;
- var g_IsValidationMutexBusy = false;
-
- ///////////////////////////
- function CheckIfUserChanged()
- {
- <% jsTRY %>
- var szUser;
- var szPass;
- var szConfirm;
-
- if( document.forms.pluginForm.username.value == "<%= EscBackslashChar( Left( RemoveSpecifiedChars( SafeUnescape( trim( strUserName ) ), REGEXT_ILLEGAL_UNAME_CHARS ), MAX_USERNAME ) ) %>" )
- {
- return( false );
- }
-
- if( document.forms.pluginForm.password.value == "<%= Server.HTMLEncode( L_PASSWORDPHOLD_TEXT ) %>" )
- {
- document.forms.pluginForm.password.value = "";
- document.forms.pluginForm.confirm.value = "";
- return( true );
- }
-
- if( document.forms.pluginForm.confirm.value == "<%= Server.HTMLEncode( L_PASSWORDPHOLD_TEXT ) %>" )
- {
- document.forms.pluginForm.password.value = "";
- document.forms.pluginForm.confirm.value = "";
- return( true );
- }
-
- szUser = new String( document.forms.pluginForm.username.value );
- if( 0 == szUser.length )
- {
- return( true );
- }
- <% jsCATCH %>
- return( true );
- }
-
- ///////////////////////////
- function ValidateUserPass()
- {
- <% jsTRY %>
- var szUser = "";
- var szPass = "";
- var szConf = "";
- var bUserOkay = true;
- var bError = false;
- var bUserChanged = false;
-
- if( true == g_IsValidationMutexBusy )
- {
- return( true );
- }
- g_IsValidationMutexBusy = true;
-
- document.forms.pluginForm.ok.disabled = false;
-
- bUserChanged = CheckIfUserChanged();
-
- szUser = new String( document.forms.pluginForm.username.value )
- szPass = new String( document.forms.pluginForm.password.value )
- szConf = new String( document.forms.pluginForm.confirm.value )
-
- if( ( 0 == szUser.length ) && ( 0 == szPass.length ) && ( 0 == szConf.length ) )
- {
- // it's legal to clear all credentials
- if( false == bError )
- {
- document.forms.pluginForm.ok.disabled = false;
- window.status = "";
- }
- g_IsValidationMutexBusy = false;
- return( true );
- }
-
- if( ( 0 == szUser.length ) || bUserChanged )
- {
- document.forms.pluginForm.ok.disabled = ( 0 == szUser.length ) && ( ( 0 < szPass.length ) || ( 0 < szConf.length ) );
- }
-
- // check username
- var szFilteredUser = RemoveBadUsernameChars( szUser );
- if( szUser.length != szFilteredUser.length )
- {
- document.forms.pluginForm.username.style.color = "#FF0000";
- document.forms.pluginForm.ok.disabled = true;
- bError = true;
- window.status = "<%= L_USERNAMEBADCHAR_TEXT %>";
- if( false == g_bUserAlertedToBadUerName )
- {
- g_bUserAlertedToBadUerName = true;
- window.alert( "<%= L_INVALIDCHARSINUSERNAME_TEXT %>" );
- }
- }
- else
- {
- document.forms.pluginForm.username.style.color = "#000000";
- }
-
- // if any changes to pass or confirm, wipe canned password fields
- if( ( ( "<%= L_PASSWORDPHOLD_TEXT %>" == document.forms.pluginForm.password.value ) &&
- ( "<%= L_PASSWORDPHOLD_TEXT %>" != document.forms.pluginForm.confirm.value ) ) ||
- ( ( "<%= L_PASSWORDPHOLD_TEXT %>" != document.forms.pluginForm.password.value ) &&
- ( "<%= L_PASSWORDPHOLD_TEXT %>" == document.forms.pluginForm.confirm.value ) ) )
- {
- document.forms.pluginForm.password.value = document.forms.pluginForm.confirm.value = "";
- g_IsValidationMutexBusy = false;
- return( true );
- }
-
- // if any changes to username, wipe canned password fields
- if( ( ( 0 < szConf.length ) || ( 0 < szPass.length ) ) && ( szPass.length != szConf.length ) )
- {
- if( ( "<%= L_PASSWORDPHOLD_TEXT %>" == document.forms.pluginForm.password.value ) ||
- ( "<%= L_PASSWORDPHOLD_TEXT %>" == document.forms.pluginForm.confirm.value ) )
- {
- szPass = "";
- szConf = "";
- document.forms.pluginForm.password.value = document.forms.pluginForm.confirm.value = "";
- g_IsValidationMutexBusy = false;
- return( true );
- }
- }
-
- if( "<%= L_PASSWORDPHOLD_TEXT %>" != document.forms.pluginForm.password.value )
- {
- var szFilteredPass = RemoveDangerousCharacters( szPass );
- if( szPass.length != szFilteredPass.length )
- {
- document.forms.pluginForm.password.style.color = "#FF0000";
- document.forms.pluginForm.ok.disabled = true;
- szPass = "";
- bError = true;
- window.status = "<%= L_PASSWORDBADCHAR_TEXT %>";
- if( false == g_bUserAlertedToBadPasswd )
- {
- g_bUserAlertedToBadPasswd = true;
- window.alert( "<%= L_PASSWORDBADCHAR_TEXT %>" );
- }
- }
- else
- {
- document.forms.pluginForm.password.style.color = "#000000";
- }
- }
-
- if( "<%= L_PASSWORDPHOLD_TEXT %>" != document.forms.pluginForm.confirm.value )
- {
- var szFilteredConf = RemoveDangerousCharacters( szConf );
- if( szConf.length != szFilteredConf.length )
- {
- document.forms.pluginForm.confirm.style.color = "#FF0000";
- document.forms.pluginForm.ok.disabled = true;
- szConf = "";
- bError = true;
- window.status = "<%= L_PASSWORDBADCHAR_TEXT %>";
- if( false == g_bUserAlertedToBadPasswd )
- {
- g_bUserAlertedToBadPasswd = true;
- window.alert( "<%= L_PASSWORDBADCHAR_TEXT %>" );
- }
- }
- else
- {
- document.forms.pluginForm.confirm.style.color = "#000000";
- }
- }
-
- if( true == bError )
- {
- document.forms.pluginForm.ok.disabled = true;
- }
- else
- {
- window.status = "";
- if( ( 0 == szUser.length ) && ( 0 == szPass.length ) && ( 0 == szConf.length ) )
- {
- document.forms.pluginForm.ok.disabled = false;
- g_IsValidationMutexBusy = false;
- return( true );
- }
-
- if( ( false == bError ) && document.forms.pluginForm.password.value == document.forms.pluginForm.confirm.value )
- {
- if( 0 < szUser.length )
- {
- document.forms.pluginForm.ok.disabled = false;
- }
- g_IsValidationMutexBusy = false;
- return( true );
- }
- }
-
- document.forms.pluginForm.ok.disabled = true;
- g_IsValidationMutexBusy = false;
- return( true );
- <% jsCATCH %>
- }
- -->
- </script>
- <% end if %>
- </head>
- <body class="pluginBody" width="100%" <%if( SHOWING_DISTCRED = dwDisplayMode ) then %> onLoad="JavaScript:ValidateUserPass();"<% end if %> oncontextmenu="JavaScript:event.cancelBubble=true;return false;">
- <%
- tabIndex = 0
- DrawPropPageBanner strTitleString
- WriteStdPluginForm
- %>
- <table border=0 cellpadding=0 cellspacing=0 width="90%">
- <tr>
- <td>
-
- </td>
- <td valign="top">
- <p> <br>
- <table class="propgroupbox" cellspacing=1 cellpadding=0 border=0 width="90%">
- <tr>
- <td colspan=3>
- <% if( SHOWING_BUFFERSETTING = dwDisplayMode ) then %>
- <div class="subheader"><%= Server.HTMLEncode( L_BUFFERSPOPTIONS_TEXT ) %></div><br>
- <% else %>
- <div class="helptext"><%= Server.HTMLEncode( strHelpString ) %></div><br>
- <% end if %>
- <%
- if( SHOWING_DISTCRED = dwDisplayMode ) then
- %>
- </td>
- </tr>
- <tr>
- <td class="defaultcursor" nowrap>
- <% RenderWithErrorCheck Server.HTMLEncode( L_USERNAMECOLON_TEXT ), "User" %>
- </td>
- </tr>
- <tr>
- <td align=left>
- <input
- type="text"
- name="username"
- size="25"
- maxlength="<%= Server.HTMLEncode( MAX_USERNAME ) %>"
- tabindex="<%= dwTabIndex %>"<% dwTabIndex = dwTabIndex + 1 %>
- value="<%= strUserName %>"
- onKeyUp="JavaScript:ValidateUserPass();"
- onKeyDown="JavaScript:ValidateUserPass();"
- onChange="JavaScript:ValidateUserPass();"
- onPaste="JavaScript:ValidateUserPass();" >
- </td>
- </tr>
- <tr>
- <td class="defaultcursor" nowrap>
- <% RenderWithErrorCheck Server.HTMLEncode( L_PASSWORDCOLON_TEXT ), "Pass" %>
- </td>
- </tr>
- <tr>
- <td align=left>
- <input
- type="password"
- name="password"
- size="25"
- maxlength="<%= Server.HTMLEncode( MAX_PASSWD ) %>"
- tabindex="<%= dwTabIndex %>"<% dwTabIndex = dwTabIndex + 1 %>
- value="<%= strPassword %>"
- onKeyUp="JavaScript:ValidateUserPass();"
- onKeyDown="JavaScript:ValidateUserPass();"
- onChange="JavaScript:ValidateUserPass();"
- onPaste="JavaScript:ValidateUserPass();" >
- </td>
- </tr>
- <tr>
- <td class="defaultcursor" nowrap>
- <% RenderWithErrorCheck Server.HTMLEncode( L_CONFIRMCOLON_TEXT ), "Confirm" %>
- </td>
- </tr>
- <tr>
- <td align=left>
- <input
- type="password"
- name="confirm"
- size="25"
- maxlength="<%= Server.HTMLEncode( MAX_PASSWD ) %>"
- tabindex="<%= dwTabIndex %>"<% dwTabIndex = dwTabIndex + 1 %>
- value="<%= strConfirm %>"
- onKeyUp="JavaScript:ValidateUserPass();"
- onKeyDown="JavaScript:ValidateUserPass();"
- onChange="JavaScript:ValidateUserPass();"
- onPaste="JavaScript:ValidateUserPass();" >
- </td>
- </tr>
- </table>
- <br>
- <%
- elseif( SHOWING_BUFFERSETTING = dwDisplayMode ) then
- enumBufferSetting = g_objPubPoint.BufferSetting
- bBufferOnServer = CBool( 1 = CDbl( enumBufferSetting ) )
- %>
- <table cellspacing=1 cellpadding=0 border=0>
- <tr>
- <td> </td>
- <td>
- <div class="propshand">
- <input type="radio"
- name="buffering"
- value="1"
- id="buffering1"
- <%
- if bBufferOnServer then %> checked <% end if %>
- tabindex="<%= dwTabIndex %>"<% dwTabIndex = dwTabIndex + 1 %>
- >
- </div>
- </td>
- <td>
- <label for="buffering1" class="propshand"><% RenderWithErrorCheck Server.HTMLEncode( L_BUFFEROPT1_TEXT ), "enable" %></label>
- </td>
- </tr>
- <tr>
- <td> </td>
- <td>
- <div class="propshand">
- <input type="radio"
- name="buffering"
- value="2"
- id="buffering2"
- <% if not bBufferOnServer then %> checked <% end if %>
- tabindex="<%= dwTabIndex %>"<% dwTabIndex = dwTabIndex + 1 %>
- >
- </div>
- </td>
- <td>
- <label for="buffering2" class="propshand"><% RenderWithErrorCheck Server.HTMLEncode( L_BUFFEROPT2_TEXT ), "disable" %></label>
- </td>
- </tr>
- </table>
- <br>
- <%
- end if %>
- </td>
- </tr>
- </table>
- <table cellspacing="0" cellpadding="0" border="0">
- <tr>
- <td valign="bottom">
- <br>
- <input type="submit" align="baseline" name="ok" id="ok" tabIndex="<%= dwTabIndex %>"<% dwTabIndex = dwTabIndex + 1 %> value="<%= Server.HTMLEncode( L_OKAYBUTTON_TEXT ) %>">
- <input type="button" align="baseline" name="cancel" tabIndex="<%= dwTabIndex %>"<% dwTabIndex = dwTabIndex + 1 %> onclick="JavaScript:Cancel();" value="<%= Server.HTMLEncode( L_CANCELBUTTONSPACED_TEXT ) %>">
- <% if ( SHOWING_DISTCRED = dwDisplayMode ) then %>
- <input type="button" align="baseline" name="help" tabIndex="<%= dwTabIndex %>"<% dwTabIndex = dwTabIndex + 1 %> onclick="JavaScript:DoPluginHelp( '<%= H_NETCREDHELPTOPIC %>' )" value="<%= Server.HTMLEncode( L_HELPBUTTONSPACED_TEXT ) %>" id="help">
- <% elseif( SHOWING_BUFFERSETTING = dwDisplayMode ) then %>
- <input type="button" align="baseline" name="help" tabIndex="<%= dwTabIndex %>"<% dwTabIndex = dwTabIndex + 1 %> onclick="JavaScript:DoPluginHelp( '<%= H_BUFFERINGHELPTOPIC %>' )" value="<%= Server.HTMLEncode( L_HELPBUTTONSPACED_TEXT ) %>" id="help">
- <% end if %>
- </td>
- </tr>
- </table>
- </form>
- <%
- AlertUserWithPopupErrorDialog
- OnErrorGoBack
- DrawCopyrightInfo
- DrawStdFooter
- %>
- </body>
- </html>
- <%
- LatchCurrentPage "pubpoints/networking.asp", qs
- EndErrorHandling "Networking.asp"
-
- PluginsASPCleanup
- %>